<?php
error_reporting(0); 
session_start();
$userid = isset($_COOKIE["gwt_userid"]) ? $_COOKIE["gwt_userid"] : "";
$zfb = isset($_COOKIE["gwt_zfb"]) ? $_COOKIE["gwt_zfb"] : "";
$phone = isset($_COOKIE["gwt_phone"]) ? $_COOKIE["gwt_phone"] : "";
$email = isset($_COOKIE["gwt_email"]) ? $_COOKIE["gwt_email"] : "";
if ($userid == "")	$userid = "0";

//
$iid=isset($_GET['iid']) ? $_GET['iid'] : '';
$mall_id=isset($_GET['mall_id']) ? $_GET['mall_id'] : '';

$click_url=isset($_GET['click_url']) ? $_GET['click_url'] : '';
$url=isset($_GET['url']) ? $_GET['url'] : '';
if($iid =="" && $mall_id =="")
	header("Location:../");

if (!strstr($click_url, "&u=".$userid))
{
	include_once 'comm/config.php';
	include_once 'comm/Taoapi.php';
	$Taoapi_Config = Taoapi_Config::Init();
	$Taoapi_Config->setCharset('UTF-8');
	$Taoapi = new Taoapi;
	$uid=$userid;
	$Taoapi->method = 'taobao.taobaoke.items.convert';
	$Taoapi->nick = MYUSERNICK;
	$Taoapi->num_iids = $iid;
	$Taoapi->outer_code=$uid;
	$Taoapi->fields = 'click_url';
	$TaobaokeData = $Taoapi->Send('get','xml')->getArrayData();
	$click_url=$TaobaokeData["taobaoke_items"]["taobaoke_item"]["click_url"]; 

	if($click_url=="")
		$click_url="index.php";
}

//
if ($userid == "0")
{
//	echo "Location:http://www.gouwutu.com/myservices/bangding.html?ref=".urlencode($_SERVER['SERVER_NAME'].$_SERVER[ "REQUEST_URI"]);
	header( "Location:http://www.gouwutu.com/myservices/bangding.html?ref=".urlencode($_SERVER['SERVER_NAME'].$_SERVER[ "REQUEST_URI"]) );
	exit;
}
else if($mall_id !="")
{
	header( "Location:http://www.gouwutu.com/new/mall/jump.php?mall_id=$mall_id" );
	exit;
}

//
if($iid !="")
{
	if (!strstr($url, "&tracelog=jubuyitnow"))
	{
//		echo $click_url;
		header( "Location:$click_url" );
		exit;
	}
	else
	{
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>购物兔正在为您跳转到商城-购物兔，返现就这么简单</title>
<meta name ="keywords" content="返现,搜返现,返现简单,购物返现,返现最快,购物返利,网购返利,网购省钱,网购安全,安全购物,打折,折扣,省钱达人,购物达人,省钱省力省心"/>
<meta name="Description" content="购物兔致力于电子商务，旨在让您网购省钱省力更省心，购物兔特点是返现简单，返现最快，是您网购省钱、网购安全的第一选择。只需搜一搜，返现就这么简单！" />
<style type="text/css">
html{overflow-y:auto}
body{font:12px arial;background:#FFFBFC;}
body,p,form,ul,li{margin:0;padding:0;list-style:none}
body,form,#fm{position:relative}
td{text-align:left}
img{border:0}
#lk { height:40px; line-height:40px; background:#f5f5f5; padding-left:90px;}
.Unbound { margin-top:40px;}
.Unbound .sel { padding-left:50px; overflow:hidden; display:block; height:25px;}
.Unbound .sel li { float:left; margin:0 10px; height:25px; line-height:25px; cursor:pointer; padding:0 10px;}
.Unbound .ted { clear:both; overflow:hidden; padding:0;}
.Unbound .ted li p { padding:10px 145px; height:25px; line-height:25px;}
.Unbound .ted li p span { width:80px; display:block; float:left;}
.Unbound .ted li #zfbzh,.Unbound .ted li #email_tel { height:20px; line-height:20px; width:200px; float:left; border:1px solid #ccc;}
#shezhi { border:1px solid red; height:25px; width:50px; text-align:center; line-height:25px; background:#E75718; color:#fff; cursor:pointer;}

#wrapper{position:absolute;left:50%;top:50%;width:454px;height:85px;padding:90px 17px;margin:0px 0 0 -244px;text-align:center;font-size:12px; border:2px #CCCCCC solid;}
#loading{position:absolute;right:22px;top:30px}
#desc{height:45px;font-size:14px;font-weight:bold}
#desc big{font-size:16px;color:#f00}
#action{color:#666}
#action a{color:#f00;text-decoration:none}
#tip{position:absolute;bottom:29px;left:19px;width:454px;line-height:35px;color:#666}
iframe{display:none}

</style>
<script language="javascript" src="../js/common.js"></script>
</head>

<body onload="javascript:OnBodyLoad();">
<script language="javascript">
function OnBodyLoad()
{
	var iframe = document.createElement("iframe");
	iframe.src = "<?PHP echo $click_url; ?>";
//	iframe.style="display:none";
	iframe.width=1;
	iframe.height=1;
	if (iframe.attachEvent)
	{
    	iframe.attachEvent("onload", OnIFrameLoad);
	}
	else 
	{
    	iframe.onload = OnIFrameLoad;
	}

	document.body.appendChild(iframe);
}
var bFinish = 0;
function OnIFrameLoad()
{
	bFinish += 1;
	document.getElementById( "action" ).style.visibility="";
}
</script>

<form name="loading" style=" width:100%; height:30px; margin:0px;"> 
<div id="wrapper">
	<img id="loading" src="http://fanli.gouwutu.com/template/default/images/cps_redirecting.gif" alt="正在转向"/>
	<div id="desc">购物兔正在带您去聚划算返现，请稍等...</div>
	<div id="action" style="visibility:hidden">如果您的浏览器等了许久还没自动跳转，请点击这里：<a href="<?PHP echo $url ?>" target="_self">跳转到商品页面</a></div>
	<div id="tip">
<font color="#0066ff">正在转入中，请稍等</font><font color="#0066ff" size="2" face="Arial">...</font><br>
<input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#fe6d01; background-color:#fff; padding:0px; border-style:none;">
<input name=percent size=47 style="color:#0066ff; text-align:center; border-width:medium; border-style:none;" type="hidden">
<script language="javascript">　 
var bar=0;
var line="||";
var amount="||";
count();
function count()
{　 
	bar=bar+2;
	amount =amount + line;
	document.loading.chart.value=amount;
	document.loading.percent.value=bar+"%";
	if (bar<99 || bFinish < 2) 
	{
		setTimeout("count()",50);
	}　 
	else　 
	{
		window.open('<?PHP echo $url."&gwt_param=".$userid ?>', '_self');	
	}
}
</script> 
　</p> 
 </div>
</div>
</form>
</body>
</html>

<?PHP } } ?>
